package com.todod.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.todod.entity.ResultData;
import com.todod.mapper.ProjectInfoRecordsMapper;
import com.todod.model.ProjectInfoRecords;
import com.todod.service.ProjectInfoRecordsService;

/**
 * @author dyl
 * @date 2023-08-22
 */
@RestController
@RequestMapping("/projectInfoRecords")
public class ProjectInfoRecordsController extends BaseManageController {

	@Autowired
	public ProjectInfoRecordsService projectInfoRecordsService;
	@Autowired
	public ProjectInfoRecordsMapper projectInfoRecordsMapper;

	/**
	 * @author dyl
	 * @date 2023-08-22
	 * @param _userId
	 * @param reqProjectInfoRecords
	 * @return
	 */
	@PostMapping("/save")
	public ResultData saveData(@RequestAttribute Long _userId, @RequestBody ProjectInfoRecords projectInfoRecords) {

		projectInfoRecordsService.saveData(_userId, projectInfoRecords);

		return ResultData.success();
	}

	/**
	 * 
	 * @param _userId
	 * @return
	 */
	@RequestMapping("/getListByProjectId")
	public ResultData getListByProjectId(@RequestAttribute Long _userId, Long projectId) {
		// 获取审批记录数据
		List<ProjectInfoRecords> list = projectInfoRecordsService.getListByProjectId(projectId);
		return ResultData.success("ok", list);
	}

}
